import { clone, hasOwn, PAGE_KEYS } from '@shared';

// 查询选项卡页面
export function findTabBarPage(pagePath, tabBar) {
  const tabPage = tabBar.list.find((element) => {
    return element.pagePath === pagePath;
  });
  let tabPageSync = tabPage ? clone(tabPage) : null;
  if (tabPageSync) {
    delete tabPageSync.pagePath;
  }
  return tabPageSync;
}
// 检测是否有配置选项卡页面
export function hasTabBarList(tabBar) {
  return tabBar && hasOwn(tabBar, PAGE_KEYS.TAB_LIST);
}
